#include "DualClientRecvHandler.h"
#include "DualServerSendHandler.h"

using namespace log4cplus;

Logger DualClientRecvHandler::log=GetLogger(LOG4CPLUS_TEXT("DualClientRecvHandler"));

void DualClientRecvHandler::GetRecvSendInfo(ClientContext &client,SOCKET *recvSock,SOCKET *sendSock,WSABUF **buf,OVERLAPPED **ovl,WSABUF **weakRefBuf)
{
	unsigned int clienSequenceNo=client.SequenceNo();
	LOG4CPLUS_DEBUG_FMT(log,LOG4CPLUS_TEXT("[Client%d]Dual client receive handler set recvsend info."),clienSequenceNo);
	*recvSock=client.SrcSock();
	*buf=client.Buffer();
	*ovl=client.OVL();
	*weakRefBuf=client.WeakRefBuffer();
	*sendSock=client.DestSock();
}

void DualClientRecvHandler::SetNextHandler(ClientContext &client)
{
	delete client.ExtContext().SetSrcHandler(new DualServerSendHandler());
}